package com.zxf.basic.expand

import io.reactivex.Flowable
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers

fun <T> Observable<T>.observeOnMain(): Observable<T> =
        observeOn(AndroidSchedulers.mainThread())

fun <T> Observable<T>.observeOnIo(): Observable<T> =
        observeOn(Schedulers.io())

fun <T> Observable<T>.subscribeOnIo(): Observable<T> =
        subscribeOn(Schedulers.io())

fun <T> Observable<T>.subscribeOnNewThread(): Observable<T> =
        subscribeOn(Schedulers.newThread())

fun <T> Flowable<T>.observeOnMain(): Flowable<T> =
        observeOn(AndroidSchedulers.mainThread())

fun <T> Flowable<T>.subscribeOnIo(): Flowable<T> =
        subscribeOn(Schedulers.io())